import tkinter as tk
from tkinter import ttk
from tkinter import Menu
#主运行
#bili：崩析 博客园：戳人痛处
#https://www.bilibili.com/video/BV1iP4y1t7NC?share_source=copy_web 硬币 懂？
#https://www.cnblogs.com/hardfood
import sqlite_api
import fix
sw=sqlite_api.sqlite_deal()



win = tk.Tk()
column_name = ('id','create_time','lastchange_time','jira_number','item_name','task','tester','if_finish','remark','sendtest_time','finish_time')
def create_new_row():
    sw.create_row()
    fix.update_treeveiw(win,tree).treeview_update()
menuBar = Menu(win) # 1------------开辟菜单并生成对象
menuBar.add_command(label='创建行',command=create_new_row)
win.config(menu=menuBar)#----------配置生效


tree = ttk.Treeview(win,height=10,show='headings',columns=column_name,selectmode='extended')
for i_1 in range(0,11):
    tree.heading(str(i_1),text=column_name[i_1])
    tree.column(str(i_1),width=100,anchor='center')
    print(i_1)
    print(column_name[i_1])
# sw.create_row()
data = sw.get_all_data()
def p_out(e):
    t_meun=fix.data_option(win,tree,e)
    t_meun.double_click_change_row_data()
def r_k(e):
    t_meun=fix.data_option(win,tree,e)
    t_meun.right_key_menu()
tree.bind('<Double-Button-1>',p_out)
tree.bind('<Button-3>',r_k)
print(data)
for x in data:
    tree.insert('','end',value=x)
tree.pack()

win.mainloop()